import turtle
import math

def draw_petal(t, radius, angle):
    """绘制一个弯曲的花瓣"""
    t.circle(radius, angle)
    t.left(180 - angle)
    t.circle(radius, angle)
    t.left(180 - angle)

def draw_stamen(t, length):
    """绘制花蕊"""
    t.forward(length)
    t.backward(length)

def draw_red_spider_lily():
    # 创建画布和画笔
    screen = turtle.Screen()
    screen.title("曼珠沙华")
    screen.bgcolor("black")
    
    flower = turtle.Turtle()
    flower.speed(10)
    flower.color("red", "red")
    flower.pensize(2)
    
    # 绘制花瓣
    petal_count = 6  # 曼珠沙华通常有6片花瓣
    angle_between_petals = 360 / petal_count
    
    for _ in range(petal_count):
        flower.begin_fill()
        draw_petal(flower, 100, 60)
        flower.end_fill()
        flower.right(angle_between_petals)
    
    # 绘制花蕊
    flower.penup()
    flower.goto(0, 0)
    flower.color("yellow")
    flower.pensize(1)
    flower.pendown()
    
    stamen_count = 12
    angle_between_stamens = 360 / stamen_count
    
    for _ in range(stamen_count):
        draw_stamen(flower, 30)
        flower.right(angle_between_stamens)
    
    # 绘制花茎
    flower.penup()
    flower.goto(0, 0)
    flower.setheading(270)  # 向下
    flower.color("green")
    flower.pensize(3)
    flower.pendown()
    flower.forward(200)
    
    # 绘制叶子（曼珠沙华花叶永不相见，这里注释掉叶子部分）
    # flower.right(45)
    # flower.forward(60)
    # flower.backward(60)
    # flower.left(90)
    # flower.forward(60)
    
    # 隐藏画笔
    flower.hideturtle()
    
    # 保持窗口打开
    screen.mainloop()

if __name__ == "__main__":
    draw_red_spider_lily()
